﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GBG_DBM.Support.DAL.Entities;

namespace GBG_DBM.Support.DAL
{
    public class DBAccessory
    {
        private DAO _DAO = new DAO();
        private CUR _CUR;
        private Formula _Formula;
        private Freight _Freight;
        private Supplier_RM _SupplierRM;

        public float EstimatedCostCalculate() 
        {
            if (_Freight.Supplier == "DHL")
                return _Freight.SupplierPrice * (1 + _Freight.VariableFuel) * _Freight.ProductWeight;
            else
                return _Freight.SupplierPrice * _Freight.ProductWeight;
        }
        //public float TotalCostCalculate()
        //{
        //    int Tar = 1 + _SupplierRM.EstimatedLoss;
        //    //float Cur=_CUR.CurrencyCalculate();
        //    float EstimatedCost=this.EstimatedCostCalculate();
        //    return (Cur * EstimatedCost) * Convert.ToInt32(Tar);
        //}
        //public float TotalCostOfShipCalculate() { }
        /***********************
         *Currency Manipulation*
         *                     *
         ***********************/
        public CUR getCUR()
        {
            return _DAO.getCUR();
        }
        public CUR getCURbyCurrency(string Currency) 
        {
            return _DAO.getCURbyCurrency(Currency);
        }
        public void setCUR(CUR _CUR)
        {
            _DAO.setCUR(_CUR);
        }
        public void addCUR(CUR _CUR) 
        {
            _DAO.addCUR(_CUR);
        }
        public void deleteCUR(string Cur)
        {
            _DAO.deleteCUR(Cur);
        }
        /***********************
         *Freight Manipulation *
         *                     *
         ***********************/
        public Freight getFreight()
        {
            return _DAO.getFreight();
        }
        public Freight getFreightByType(string FreightType) 
        {
            return _DAO.getFreightByType(FreightType);
        }
        public void setFreight(Freight _Freight)
        {
            _DAO.setFreight(_Freight);
        }
        public void addFreight(Freight _Freight)
        {
            _DAO.addFreight(_Freight);
        }
        public void deleteFreight(Freight _Freight)
        {
            _DAO.deleteFreight(_Freight);
        }
        /***********************
         *STD Manipulation     *
         *                     *
         ***********************/
        public STD getSTD()
        {
            try
            {
                return _DAO.getSTD();
            }
            catch (Exception e)
            {
                return new STD();
            }
        }
		public STD getSTDByCode(string Code) 
		{
			return _DAO.getSTDByCode(Code);
		}
        public void setSTD(STD _STD) 
        {
            _DAO.setSTD(_STD); 
        }
        public void addSTD(STD _STD)
        {
            _DAO.addSTD(_STD);
        }
        public void deleteSTD(STD _STD) 
        {
            _DAO.deleteSTD(_STD);
        }
        /***********************
         *Package Manipulation *
         *                     *
         ***********************/
        public Packaging getPackage()
        {
            return _DAO.getPackage();
        }
        public Packaging getPackageById(string id) 
        {
            return _DAO.getPackageById(id);
        }
		public float getPackagePriceById(string id) 
		{
			return _DAO.getPackagePriceById(id);
		}
        public void setPackage(Packaging _Packaging)
        {
            _DAO.setPackage(_Packaging);
        }
        public void addPackege(Packaging _Packaging) 
        {
            _DAO.addPackege(_Packaging);
        }
        public void deletePackage(Packaging _Packaging) 
        {
            _DAO.deletePackage(_Packaging);
        }
        /*************************
        *SupplierRM Manipulation *
        *                        *
        **************************/
        public Supplier_RM getSupplier()
        {
            return _DAO.getSupplierRM();
        }
		public Supplier_RM getSupplierRMbyCodeAndSupplier(string code, string SupplierName) 
		{
			return _DAO.getSupplierRMbyCodeAndSupplier(code, SupplierName);
		}
		public Supplier_RM getSupplierByCode(string code) 
		{
			return _DAO.getSupplierByCode(code);
		}
        public string getSupplierCode(string code) 
        {
            return _DAO.getSupplierCode(code);
        }
        public Supplier_RM getSupplierBySupplierCode(string r) 
        {
            return _DAO.getSupplierBySupplierCode(r);
        }
		public string[] getSupplierNameBycode(string code) 
		{
			return _DAO.getSupplierNameBycode(code);
		}
        public void setSupplierRM(Supplier_RM Supplier_RM) 
        {
             _DAO.setSupplierRM(Supplier_RM);
        }
        public void addSupplierRM(Supplier_RM Supplier_RM) 
        {
            _DAO.addSupplierRM(Supplier_RM);
        }

        public void deleteSupplierRM(Supplier_RM Supplier_RM)
        {
            _DAO.deleteSupplierRM(Supplier_RM);
        }
        /**********************************
        *RawMaterialSupplier Manipulation *
        *                                 *
        ***********************************/
        public RawMaterialSupplier getRawMaterialSupplier()
        {
            return _DAO.getRawMaterialSupplier();
        }
        public RawMaterialSupplier getRawMaterialSupplierByCode(string Supplier_Code) 
        {
            return _DAO.getRawMaterialSupplierByCode(Supplier_Code);
        }

        public void setRawMaterialSupplier(RawMaterialSupplier _RawMaterialSupplier) 
        {
            _DAO.setRawMaterialSupplier(_RawMaterialSupplier);
        }
        public void addRawMaterialSupplier(RawMaterialSupplier _RawMaterialSupplier) {
            _DAO.addRawMaterialSupplier(_RawMaterialSupplier);    
        }
        public void deleteRawMaterialSupplier(RawMaterialSupplier _RawMaterialSupllier)
        {
            _DAO.deleteRawMaterialSupplier(_RawMaterialSupllier);
        }
        public void addIngredient(Ingredient _Ingredient) 
        {
            _DAO.addIngredient(_Ingredient);
        }
        /**********************************
        *Ingredient Manipulation          *
        *                                 *
        ***********************************/
        public Ingredient getIngredientByCode(string IngredientCode) 
        {
            return _DAO.getIngredientByCode(IngredientCode);
        }
        public void deleteIngredient(string code) 
        {
             _DAO.deleteIngredient(code);
        }
        public void deleteIngredientByIngredient(Ingredient _Ingredient) 
        {
            _DAO.deleteIngredientByIngredient(_Ingredient);
        }




        internal void addFormula(Formula _Formula, List<string> Code)
        {
            
        }
    }
}
